

<!DOCTYPE html>
<html class="writer-html5" lang="en" >
<head>
  <meta charset="utf-8">
  
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  
  <title>Toolbox Settings &mdash; Causal Discovery Toolbox 0.5.22 documentation</title>
  

  
  <link rel="stylesheet" href="_static/css/theme.css" type="text/css" />
  <link rel="stylesheet" href="_static/pygments.css" type="text/css" />
  <link rel="stylesheet" href="_static/custom.css" type="text/css" />

  
  
    <link rel="shortcut icon" href="_static/favicon.png"/>
  
  
  

  
  <!--[if lt IE 9]>
    <script src="_static/js/html5shiv.min.js"></script>
  <![endif]-->
  
    
      <script type="text/javascript" id="documentation_options" data-url_root="./" src="_static/documentation_options.js"></script>
        <script src="_static/jquery.js"></script>
        <script src="_static/underscore.js"></script>
        <script src="_static/doctools.js"></script>
        <script src="_static/language_data.js"></script>
        <script async="async" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.7/latest.js?config=TeX-AMS-MML_HTMLorMML"></script>
        <script type="text/x-mathjax-config">MathJax.Hub.Config({"extensions": ["tex2jax.js"], "jax": ["input/TeX", "output/HTML-CSS"], "tex2jax": {"inlineMath": [["$", "$"], ["\\(", "\\)"]], "displayMath": [["$$", "$$"], ["\\[", "\\]"]], "processEscapes": true}, "HTML-CSS": {"fonts": ["TeX"]}})</script>
    
    <script type="text/javascript" src="_static/js/theme.js"></script>

    
    <link rel="index" title="Index" href="genindex.html" />
    <link rel="search" title="Search" href="search.html" />
    <link rel="next" title="PyTorch Models" href="models.html" />
    <link rel="prev" title="cdt.metrics" href="metrics.html" /> 
</head>

<body class="wy-body-for-nav">

   
  <div class="wy-grid-for-nav">
    
    <nav data-toggle="wy-nav-shift" class="wy-nav-side">
      <div class="wy-side-scroll">
        <div class="wy-side-nav-search" >
          

          
            <a href="index.html">
          

          
            
            <img src="_static/banner.png" class="logo" alt="Logo"/>
          
          </a>

          
            
            
              <div class="version">
                0.5.22
              </div>
            
          

          
<div role="search">
  <form id="rtd-search-form" class="wy-form" action="search.html" method="get">
    <input type="text" name="q" placeholder="Search docs" />
    <input type="hidden" name="check_keywords" value="yes" />
    <input type="hidden" name="area" value="default" />
  </form>
</div>

          
        </div>

        
        <div class="wy-menu wy-menu-vertical" data-spy="affix" role="navigation" aria-label="main navigation">
          
            
            
              
            
            
              <ul>
<li class="toctree-l1"><a class="reference internal" href="index.html">Causal Discovery Toolbox Documentation</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="tutorial.html">Get started</a></li>
<li class="toctree-l1"><a class="reference internal" href="causality.html">cdt.causality</a></li>
<li class="toctree-l1"><a class="reference internal" href="independence.html">cdt.independence</a></li>
<li class="toctree-l1"><a class="reference internal" href="data.html">cdt.data</a></li>
<li class="toctree-l1"><a class="reference internal" href="utils.html">cdt.utils</a></li>
<li class="toctree-l1"><a class="reference internal" href="metrics.html">cdt.metrics</a></li>
<li class="toctree-l1 current"><a class="current reference internal" href="#">Toolbox Settings</a></li>
<li class="toctree-l1"><a class="reference internal" href="models.html">PyTorch Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="developer.html">Developer Documentation</a></li>
</ul>

            
          
        </div>
        
      </div>
    </nav>

    <section data-toggle="wy-nav-shift" class="wy-nav-content-wrap">

      
      <nav class="wy-nav-top" aria-label="top navigation">
        
          <i data-toggle="wy-nav-top" class="fa fa-bars"></i>
          <a href="index.html">Causal Discovery Toolbox</a>
        
      </nav>


      <div class="wy-nav-content">
        
        <div class="rst-content">
        
          















<div role="navigation" aria-label="breadcrumbs navigation">

  <ul class="wy-breadcrumbs">
    
      <li><a href="index.html" class="icon icon-home"></a> &raquo;</li>
        
      <li>Toolbox Settings</li>
    
    
      <li class="wy-breadcrumbs-aside">
        
            
            <a href="_sources/settings.rst.txt" rel="nofollow"> View page source</a>
          
        
      </li>
    
  </ul>

  
  <hr/>
</div>
          <div role="main" class="document" itemscope="itemscope" itemtype="http://schema.org/Article">
           <div itemprop="articleBody">
            
  <div class="section" id="module-cdt.utils.Settings">
<span id="toolbox-settings"></span><h1>Toolbox Settings<a class="headerlink" href="#module-cdt.utils.Settings" title="Permalink to this headline">¶</a></h1>
<p>The <code class="docutils literal notranslate"><span class="pre">cdt.utils.Settings</span></code> module defines the settings used in the toolbox,
such as the default hardware parameters; and the tools to autodetect the
hardware. All parameters are overridable by accessing the <code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS</span></code>
object, a unique instance of the <code class="docutils literal notranslate"><span class="pre">cdt.utils.ConfigSettings</span></code> class.</p>
<p>The various attributes of the <code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS</span></code> configuration object are:</p>
<ol class="arabic simple">
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.NJOBS</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.GPU</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.default_device</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.autoset_config</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.verbose</span></code></p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.rpath</span></code></p></li>
</ol>
<p>The hardware detection revolves around the presence of GPUs. If GPUs are
present, <code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.GPU</span></code> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code> and the number of jobs
is set to the number of GPUs. Else the number of jobs is set to the number
of CPUs. Another test performed at startup is to check if an R framework
is available, unlocking additional features of the toolbox.</p>
<p><code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS.rpath</span></code> allows the user to set a custom path for the Rscript
executable. It should be overriden with the full path as a string.</p>
<dl class="py class">
<dt id="cdt.utils.Settings.ConfigSettings">
<em class="property">class </em><code class="sig-prename descclassname">cdt.utils.Settings.</code><code class="sig-name descname">ConfigSettings</code><a class="reference internal" href="_modules/cdt/utils/Settings.html#ConfigSettings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cdt.utils.Settings.ConfigSettings" title="Permalink to this definition">¶</a></dt>
<dd><p>Defining the class for the hardware/high level settings of the CDT.</p>
<dl class="field-list simple">
<dt class="field-odd">Variables</dt>
<dd class="field-odd"><ul class="simple">
<li><p><strong>NB_JOBS</strong> (<em>int</em>) – Number of parallel jobs that can be executed on current
hardware.</p></li>
<li><p><strong>GPU</strong> (<em>int</em>) – The number of available GPUs ; defaults to <cite>0</cite>.</p></li>
<li><p><strong>default_device</strong> (<em>str</em>) – Default device used for pytorch jobs.</p></li>
<li><p><strong>verbose</strong> (<em>bool</em>) – Sets the verbosity of the toolbox algorithms.</p></li>
<li><p><strong>rpath</strong> (<em>str</em>) – Path of the <cite>Rscript</cite> executable.</p></li>
</ul>
</dd>
</dl>
<dl class="py method">
<dt id="cdt.utils.Settings.ConfigSettings.get_default">
<code class="sig-name descname">get_default</code><span class="sig-paren">(</span><em class="sig-param"><span class="o">*</span><span class="n">args</span></em>, <em class="sig-param"><span class="o">**</span><span class="n">kwargs</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cdt/utils/Settings.html#ConfigSettings.get_default"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cdt.utils.Settings.ConfigSettings.get_default" title="Permalink to this definition">¶</a></dt>
<dd><p>Get the default parameters as defined in the Settings instance.</p>
<p>This function proceeds to seamlessly retrieve the argument to pass
through, depending on either it was overidden or not: If no argument
was overridden in a function of the toolbox, the default argument will
be set to <code class="docutils literal notranslate"><span class="pre">None</span></code>, and this function will retrieve the default
parameters as defined by the <code class="docutils literal notranslate"><span class="pre">cdt.SETTINGS</span></code> ‘s attributes.</p>
<p>It has two modes of processing:</p>
<ol class="arabic simple">
<li><p>**kwargs for retrieving a single argument: <code class="docutils literal notranslate"><span class="pre">get_default(argument_name=value)</span></code>.</p></li>
<li><p>*args through a list of tuples of the shape <code class="docutils literal notranslate"><span class="pre">('argument_name',</span> <span class="pre">value)</span></code> to retrieve multiple values at once.</p></li>
</ol>
</dd></dl>

</dd></dl>

<dl class="py function">
<dt id="cdt.utils.Settings.autoset_settings">
<code class="sig-prename descclassname">cdt.utils.Settings.</code><code class="sig-name descname">autoset_settings</code><span class="sig-paren">(</span><em class="sig-param"><span class="n">set_var</span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/cdt/utils/Settings.html#autoset_settings"><span class="viewcode-link">[source]</span></a><a class="headerlink" href="#cdt.utils.Settings.autoset_settings" title="Permalink to this definition">¶</a></dt>
<dd><p>Autoset GPU parameters using CUDA_VISIBLE_DEVICES variables.</p>
<p>Return default config if variable not set.
:param set_var: Variable to set. Must be of type ConfigSettings</p>
</dd></dl>

</div>


           </div>
           
          </div>
          <footer>
  
    <div class="rst-footer-buttons" role="navigation" aria-label="footer navigation">
      
        <a href="models.html" class="btn btn-neutral float-right" title="PyTorch Models" accesskey="n" rel="next">Next <span class="fa fa-arrow-circle-right"></span></a>
      
      
        <a href="metrics.html" class="btn btn-neutral float-left" title="cdt.metrics" accesskey="p" rel="prev"><span class="fa fa-arrow-circle-left"></span> Previous</a>
      
    </div>
  

  <hr/>

  <div role="contentinfo">
    <p>
        
        &copy; Copyright 2018, Diviyan Kalainathan, Olivier Goudet

    </p>
  </div>
    
    
    
    Built with <a href="http://sphinx-doc.org/">Sphinx</a> using a
    
    <a href="https://github.com/rtfd/sphinx_rtd_theme">theme</a>
    
    provided by <a href="https://readthedocs.org">Read the Docs</a>. 

</footer>

        </div>
      </div>

    </section>

  </div>
  

  <script type="text/javascript">
      jQuery(function () {
          SphinxRtdTheme.Navigation.enable(true);
      });
  </script>

  
  
    
   

</body>
</html>